﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using DotNet.Utilities;

namespace MvcDemo.Controllers
{
    public class RegexController : Controller
    {
        // GET: Regex
        public ActionResult Index()
        {
            return View();
        }
        [ValidateInput(false)]
        public JsonResult RegexTest(string input,string pattern)
        {
            var result= RegexHelper.IsMatch(input, pattern);

            //var jsonResult = new JsonResult
            //{
            //    Data = result
            //};
            var jsonResult = new { status = result, message = pattern };
            return  Json(jsonResult, JsonRequestBehavior.AllowGet);
        }
    }
}